/*
 * 作者: 侯晓宇
 * 时间: 2017-01-24
 * 说明：
 * Copyright (c) 2016-2017 中研沃兮
 */
define(function(require) {

	require("jquery");
	require("blur");
	var c = require('app/utils/CommonUtils');
	var EventUtils = require('app/utils/EventUtils');
	var appInfo = require('app/AppInfo');

	var action = require('./action/CreateRoomFrmAction');
	
	
	$('#room_name_cover').click(function(){
		action.name_input();
   		EventUtils.listen(api.winName,'updateRoomName',true)
   		.then(function(data){
   			$("#room_name").val(data);
   		});
	});
	$('#room_live_type_cover').click(function(){
		action.livetype_input();
   		EventUtils.listen(api.winName,'updateRoomLiveType',true)
   		.then(function(data){
   			$("#room_live_type").val(data.text);
   		});
	});
	$('#room_starttime_cover').click(function(){
		action.starttime_input();
	});
	$('#room_des_cover').click(function(){
		action.des_input();
		EventUtils.listen(api.winName,'updateRoomDes',true)
   		.then(function(data){
   			$("#room_des").val(data);
   		});
		
	});
	$('#room_room_type_cover').click(function(){
		action.roomtype_input();
   		EventUtils.listen(api.winName,'updateRoomPublicType',true)
   		.then(function(data){
   			$("#room_room_type").val(data.text);
   			action.showAdditional(data.val);
   		});
	});
	$('#room_catalog_cover').click(function(){
		action.roomcatalog_input();
   		EventUtils.listen(api.winName,'updateRoomCatalog',true)
   		.then(function(data){
   			$("#room_catalog").val(data.text);
   			action.showAdditional(data.val);
   		});
	});
	
	
	action.showAdditional(0);
	
	
	//用于将选中的值传递给父窗体
	EventUtils.listenGather(function(){
		var msg = action.getRoomVal();
		//本地地址,/var/xxxx/.xxxx.jpg
		EventUtils.sendFrmVal(msg);
	});
	
	return;
});